package com.kevin.pro;

/**
 * @author Kevin Liu
 * @since 1.0.0
 */
public class TestLock {


    public static void main(String[] args) {

        Lock lock = new FiFoLock();
        Runnable runnable = ()->{
            lock.lock();
            System.out.println(Thread.currentThread().getName() + "  get the lock");
            try {
                Thread.sleep(2000L);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            lock.unlock();
        };
        Thread thread = new Thread(runnable,"thread");
        Thread thread1 = new Thread(runnable,"thread1");
        Thread thread2 = new Thread(runnable,"thread2");

        thread.start();
        thread1.start();
        thread2.start();

    }
}
